<?php 
include_once("../includes/config.php");
include_once("../includes/mod_function.inc.php");

global $TOP_CONTENT_CATEGORY_SID,$TOP_AREA_CATEGORY_SID ;

global $foxydb;

$usersid = ip_address_to_number($_SERVER['REMOTE_ADDR']);
$chksitesids = $_REQUEST['chksitesid'];
$action = $_REQUEST['action'];
$foxydb->open();
if($action == 'delete'){
	$foxydb->deleteUserFavoriteSites($usersid,$chksitesids);
}else if ($action ==  'add'){
	$foxydb->addUserFavoriteSites($usersid,$chksitesids);
}
$sites = $foxydb->selectUserFavoriteSites($usersid,100);
$foxydb->close();

include_once("../includes/header.php");
?>
  <TABLE width="100%" cellpadding=2 cellspacing=0 border=1>
  <TR><TD colspan='2' align=right><font size="-1">&nbsp;安装<A href='https://addons.mozilla.org/en-US/firefox/addon/5817' target='_blank'>一只青蛙Firefox插件</A>帮助你快速访问网站和搜索
  </font>
  </TD></TR>
  <TR>
	<TD valign="top">
		<TABLE width="100%" cellpadding=0 cellspacing=0  border=1>
		<TR>
			<TD width="99%" align="center"><font size="-1">收藏的网址</font></TD>
			<TD nowrap><font size="-1">删除</font></TD>
			<TD nowrap><font size="-1">显示积分</font></TD>
		</TR>
		<FORM action='editfavoritesites.php' method='POST' >
		<?php 
		if($sites && count($sites) > 0){
		  foreach($sites as $s){ 
		?>
		  <TR>
			<TD><A href="<?php echo $s['uri']; ?>" target=_blank><?php echo $s['name']; ?></A>&nbsp;&nbsp;<?php echo $s['description']; ?> </TD>
			<TD><INPUT type='checkbox' name='chksitesid[]' value='<?php echo $s['sid']; ?>'></TD>
			<TD nowrap='true'>[<?php echo $s['favoriteranking']?$s['favoriteranking']:"0"; ?>]<A href="editfavoritesitetag.php?sid=<?php echo $s['sid']; ?>">编辑</A></TD>
		  </TR>
		<?php }
		}?>

		<TR>
			<TD width="99%" align="center"><font size="-1">收藏的网址</font></TD>
			<INPUT type='hidden' name='action' value='delete'>
			<TD nowrap><INPUT type='submit' name='delete' value='删除'></TD>
			<TD nowrap></TD>
		</TR>
		</FORM>
		</TABLE>
	</TD>
  </TR>
  </TABLE>


<?php include("../includes/footer.php");?>